import React, { Component } from 'react';
import { DatePicker } from 'antd';
import moment from 'moment';
const RangePicker = DatePicker.RangePicker;

class DateSearch extends Component {

  onChange = (dates, dateStrings) => {
    console.log('From: ', dates[0], ', to: ', dates[1]);
    console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]);
    this.props.onChangeDate(dateStrings)
  }

  render() {
    return (
      <div>
        <RangePicker size="large"
          ranges={{ "今天": [moment(), moment()], '当前月份': [moment(), moment().endOf('month')] }}
          showTime
          format="YYYY/MM/DD HH:mm:ss"
          onChange={this.onChange}
        />

      </div>
    );
  }
}

export default DateSearch;
